﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;

namespace StolenBykes
{
    public class Warehouse
    {
       
        private string adress;
        private string owner;
    
        private int position;
    
        Bike[] bikes = new Bike[100];
        public void AddBike(Bike newBike)

        {
         
            bikes[this.position++] = newBike;
            MyEvent evt = new MyEvent();
            evt.NewBikeInWarehouse += newBike.MassageWheel;
            Thread.Sleep(5000);
            evt.OnMyEvent();
        }
        
        
        public void RemoveBike(int bikeId)
        {
    
           for(int i = 0; i < this.bikes.Length; i++)
           {
               Bike bikeI = this.bikes[i];

               //if (bikeI == null)
               //    continue;

               if (bikeI.BikeId == bikeId)
               {
                   this.bikes[i] = null;
                   break;
               }

           }
        }
        public void MassageWheel()
        {
            Console.WriteLine("У велосипеда спустило колесо");
            Console.ReadKey();
        }



     

    }




}
